/**
变长方法
 *WangGANG
 *2018/7/26
 */
package main

import "fmt"


func main() {
	println(testB("sum:%d",1,2,3,5))

	s := []int{1,2,3}
	println(testB("sum1:%d",s...))

	fmt.Println(add(1,2))

}

/*
变长方法，n可以输入多个值
 */
func testB(s string,n ...int) string {
	var x int
	for _,i := range n {
		x += i
	}
	return fmt.Sprintf(s,x)

}

func add(x,y int)(z int)  {
	z = x + y
	return z
}